<template>
  <div>
    <!--顶部搜索 -->
    <div class="top-operate">
      <el-radio-group v-model="tabActiveStatus" class="mar-b-10" @change="doChangeRadio">
        <el-radio-button label="10">待发货</el-radio-button>
        <el-radio-button label="20">部分发货</el-radio-button>
        <el-radio-button label="30">已发货</el-radio-button>
        <el-radio-button label="fail" v-if="enterpriseRoleFlag">平台发货失败</el-radio-button>
        <el-radio-button label="all">全部</el-radio-button>
      </el-radio-group>

      <!-- 第一行 -->
      <div>
        <div class="inline-flex">
          <el-select v-model="textCol" class="width-150">
            <el-option label="发货单号" value="sendNo"></el-option>
            <el-option label="订单号" value="orderNo"></el-option>
            <el-option label="子订单号" value="apartOrderNo"></el-option>
            <el-option label="平台单号" value="externalOrderNo"></el-option>
            <el-option label="供货联盟单号" value="sellApartOrderNo"></el-option>
            <el-option label="运单号" value="trackingNo"></el-option>
          </el-select>
          <el-input v-model.trim="textValue" class="width-200" placeholder="请输入内容"></el-input>
        </div>
        <div class="inline-flex">
          <el-select v-model="timeCol" class="pad-l-10 width-120">
            <el-option label="创建时间" value="createTime"></el-option>
          </el-select>
          <el-date-picker v-model="timeValue"
            type="datetimerange"
            range-separator="至"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00', '23:59:59']"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </div>
        <el-select v-model="defaultQuery.enterpriseExpressId" placeholder="请选择物流公司" class="pad-l-10 width-160" clearable>
          <el-option v-for="express in expressList"
            :key="express.enterpriseExpressId"
            :label="express.expressName"
            :value="express.enterpriseExpressId">
          </el-option>
        </el-select>
      </div>
      <!-- 第二行 -->
      <div>
        <el-select v-model="defaultQuery.printStatus" placeholder="面单打印状态" clearable class="mar-r-10 width-140">
          <el-option v-for="(val, key) in dict.printStatus" :key="key" :label="val" :value="key"></el-option>
        </el-select>
        <template v-if="tabActiveStatus == 'all'">
          <el-select v-model="defaultQuery.sendStatus" placeholder="发货单状态" clearable class="mar-r-10 width-140">
            <el-option v-for="(val, key) in dict.sendStatus" :key="key" :label="val" :value="key"></el-option>
          </el-select>
        </template>
        <el-button-group class="mar-l-20">
          <el-button type="primary" @click="doSearch">查询</el-button>
          <el-button @click="doResetSearch">重置</el-button>
        </el-button-group>
        <el-button class="mar-l-30" @click="doExport">导出</el-button>
        <template v-if="tabActiveStatus == 'fail'">
          <el-button class="mar-l-20" @click="doBatchRetry">批量重试平台发货</el-button>
        </template>
        <template v-else>
          <template v-if="!warehouseDeliverFlag && warehouseInfo.warehouseType !== 4">
            <el-button class="mar-l-20" @click="batchImportOrderVisible = true">批量导入发货</el-button>
            <el-button class="mar-l-20" @click="doBatchDelete">批量删除</el-button>
            <el-button class="mar-l-20" v-if="warehouseInfo.warehouseType !== 2" @click="doBatchPrint">批量打印</el-button>
            <!-- <el-button @click="openBatchGenerate">生成批次</el-button>
            <el-button @click="openBatchManage">打印批次管理</el-button> -->
          </template>
        </template>
      </div>
    </div>

    <div class="font-red" v-if="thirdDeliveryForm.allFail > 0 && enterpriseRoleFlag">
      <span>提示：今日共有{{ thirdDeliveryForm.todayFail }}笔发货单平台发货失败，累计有{{ thirdDeliveryForm.allFail }}笔发货单平台发货失败，请往“平台发货失败”列表处理</span>
    </div>

    <!-- 内容列表 -->
    <div class="table-container mar-t-15">
      <el-table :data="dataList" v-loading="listLoading" element-loading-text="加载中" @selection-change="handleSelectionChange">
        <el-table-column width="50px" type="selection"></el-table-column>
        <el-table-column min-width="200px" label="发货单号">
          <template slot-scope="scope">
            <div>{{ scope.row.sendNo }}</div>
          </template>
        </el-table-column>
        <el-table-column min-width="280px" label="订单号">
          <template slot-scope="scope">
            <div>订单号：{{ scope.row.orderNo }}</div>
            <div>子订单号：{{ scope.row.apartOrderNo }}</div>
            <div v-if="scope.row.externalOrderNo">平台单号：{{ scope.row.externalOrderNo }}</div>
          </template>
        </el-table-column>
        <el-table-column min-width="220px" label="收货信息">
          <template slot-scope="scope">
            <div>{{ scope.row.projectOrder.customerNickname }}</div>
            <div>{{ scope.row.projectOrder.customerPhone }}</div>
            <div class="line-2">{{ scope.row.projectOrder.customerFullAddress }}</div>
          </template>
        </el-table-column>
        <el-table-column width="200px" label="物流信息">
          <template slot-scope="scope">
            <div>{{ scope.row.expressName }}</div>
            <div v-if="scope.row.trackingNo">运单号：{{ scope.row.trackingNo }}</div>
          </template>
        </el-table-column>
        <el-table-column width="100px" label="商品数量" prop="totalGoodsNum" align="center">
        </el-table-column>
        <el-table-column width="120px" label="状态" align="center">
           <template slot-scope="scope">
            <div>
              <span>{{ dict.sendStatus[scope.row.sendStatus] }}</span>
              <span>-</span>
              <span :class="scope.row.stopFlag == 1 ? 'font-red' : ''">{{ dict.stopFlag[scope.row.stopFlag] }}</span>
            </div>
            <div class="font-blue">（{{ dict.printStatus[scope.row.printStatus] + '面单'}}）</div>
          </template>
        </el-table-column>
        <el-table-column width="140px" label="推送状态" align="left">
          <template slot-scope="scope">
            <div>{{ dict.thirdPushStatus[scope.row.thirdPushStatus] }}</div>
            <div v-if="scope.row.thirdPushStatus > 0">
              <div v-if="scope.row.thirdPushStatus == 20">
                <span v-if="scope.row.thirdDeliveryOrderId">第三方单号：{{ scope.row.thirdDeliveryOrderId }}</span>
              </div>
              <div v-else>
                <span>{{ scope.row.thirdPushResult }}</span>
              </div>
            </div>
          </template>
        </el-table-column>
        <template v-if="tabActiveStatus == 'fail'">
          <el-table-column width="180px" label="失败原因" prop="thirdDeliveryResult" class-name="font-red" align="left">
          </el-table-column>
        </template>
        <el-table-column width="180px" label="创建时间" prop="createTime" align="center">
        </el-table-column>
        <el-table-column width="100px" label="操作" align="right" fixed="right">
          <template slot-scope="scope">
            <template v-if="tabActiveStatus == 'fail'">
              <el-button type="text" size="medium" class="table-btn" @click="doRetry(scope.row)">重试平台发货</el-button>
            </template>

            <template v-else>
              <el-button type="text" size="medium" class="table-btn" @click="doLinkDetail(scope.row)">查看详情</el-button>

              <template v-if="scope.row.sendStatus == 10 && warehouseInfo.warehouseType != 4 && !warehouseDeliverFlag">

                <el-button type="text" size="medium" class="table-btn" @click="doDelete(scope.row)">删除单据</el-button>

                <template v-if="scope.row.stopFlag == 0">
                  <template v-if="scope.row.thirdPushStatus > 0">
                    <el-button v-if="scope.row.thirdPushStatus == 20" type="text" size="medium" class="table-btn" @click="doCancelThird(scope.row)">撤销推送</el-button>
                    <el-button v-else type="text" size="medium" class="table-btn" @click="doPushThird(scope.row)">重新推送</el-button>
                  </template>

                  <template v-else>
                    <el-button type="text" size="medium" class="table-btn" @click="doPrint(scope.row)">打印面单</el-button>
                    <el-button type="text" size="medium" class="table-btn" @click="doConfirmDelivery(scope.row)">确认发货</el-button>
                  </template>
                </template>

              </template>
            </template>

          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 列表分页 -->
    <div class="pagination">
      <el-pagination background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="searchListQuery.currentPage"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="searchListQuery.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>

    <!-- 打印面单dialog -->
    <el-dialog width="500px" v-el-drag-dialog title="打印面单" :visible.sync="printSendVisible" :center="true">
      <order-print-express :showFlag="printSendVisible"
        :printList="printList"
        @callback="printSendVisible = false">
      </order-print-express>
    </el-dialog>

    <!-- 发货单详情dialog -->
    <el-dialog width="1000px" v-el-drag-dialog title="发货单详情" :visible.sync="sendDetailVisible">
      <order-send-detail :showFlag="sendDetailVisible"
        :sendId="selectedSendObj.sendId"
        @callback="sendDetailVisible = false">
      </order-send-detail>
    </el-dialog>

    <!-- 发货单发货dialog -->
    <el-dialog width="400px" v-el-drag-dialog title="确认发货" :visible.sync="sendDeliveryVisible" :center="true">
      <order-send-delivery :showFlag="sendDeliveryVisible"
        :sendObj="selectedSendObj"
        @callback="doCallbackSendDelivery">
      </order-send-delivery>
    </el-dialog>

    <!-- 导入发货dialog -->
    <el-dialog width="600px" v-el-drag-dialog title="批量导入发货" :visible.sync="batchImportOrderVisible" :show-close="false">
      <import-delivery :showFlag="batchImportOrderVisible" @callback="doCallbackImportDeliver"></import-delivery>
    </el-dialog>

    <!-- 提示dialog -->
    <el-dialog width="400px" :visible.sync="hintVisible" :show-close="false">
      <el-row class="pad-l-30 pad-r-30">
        <el-col class="mar-b-20">
          <span>共处理</span>
          <span>{{ hintForm.total }}</span>
          <span>笔订单，其中成功加入批次</span>
          <span>{{ hintForm.successCount }}</span>
          <span>笔订单，</span>
          <span>{{ hintForm.failCount }}</span>
          <span>笔由于已属于其它批次或不由总部发货未加入。</span>
        </el-col>
        <el-col class="mar-b-10" align="center">
          <el-button type="text" v-show="hintForm.failOrderNos" @click="handleClipboard(hintForm.failOrderNos, $event)">
            复制未加入批次的订单号</el-button>
        </el-col>
      </el-row>
      <div class="dialog-footer mar-b-10">
        <el-button type="primary" @click="doHintConfirm">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 生成批次dialog -->
    <el-dialog title="生成批次" width="500px" v-el-drag-dialog :visible.sync="batchGenerateVisible">
      <batch-generate :showFlag="batchGenerateVisible" :initOrderIds="selectOrderIds" @close="closeBatchGenerate">
      </batch-generate>
    </el-dialog>

    <!-- 批次管理dialog -->
    <el-dialog title="批次管理" width="1000px" v-el-drag-dialog :visible.sync="batchManageVisible" close-on-click-modal>
      <batch-manage :showFlag="batchManageVisible" @toLinkPrint="linkPrint"></batch-manage>
    </el-dialog>

    <!-- 批量打印管理dialog -->
    <el-dialog title="批量打印管理" width="800px" :visible.sync="batchPrintVisible">
      <batch-print :showFlag="batchPrintVisible" :initBatchId="selectBatchId"></batch-print>
    </el-dialog>

  </div>
</template>

<script>
  import { listExpress } from '@/api/goods/express'
  import { listOrderFromBaseByOrderIds } from '@/api/goods/orderPrintBatch'
  import { downloadFile } from '@/api/common/common'
  import {
    pagingSend,
    countThirdDeliveryFail,
    doSendDelete,
    doSendPushThird,
    doSendCancelThird,
    doRetryThirdDelivery
  } from '@/api/order/projectSend'
  import { getBySupplierId } from '@/api/user/supplier-config'
  import { getByEnterpriseId } from '@/api/user/enterprise'
  import { getWarehouse } from '@/api/warehouse/warehouseInfo'
  import { getDictByGroupName } from '@/api/common/common'

  import elDragDialog from '@/directive/el-dragDialog'
  import clipboard from '@/utils/clipboard'
  import orderSendDetail from '@/views/goods/order/components/order-send-detail'
  import orderSendDelivery from '@/views/goods/order/components/order-send-delivery'
  import batchGenerate from '@/views/goods/order/components/batch-generate'
  import batchManage from '@/views/goods/order/components/batch-manage'
  import batchPrint from '@/views/goods/order/components/batch-print'
  import orderPrintExpress from '@/views/goods/order/components/order-print-express'
  import importDelivery from './components/import-delivery'

  export default {
    components: {
      batchGenerate,
      batchManage,
      batchPrint,
      importDelivery,
      orderSendDetail,
      orderSendDelivery,
      orderPrintExpress
    },
    directives: {
      elDragDialog
    },
    data() {
      return {
        // 文本model
        textCol: 'sendNo',
        textValue: '',
        // 时间model
        timeCol: 'createTime',
        timeValue: '',
        // tab model
        tabActiveStatus: 'all',
        // 默认查询
        defaultQuery: {
          currentPage: 1,
          size: 10,
          enterpriseId: '',
          supplierId: '',
          warehouseId: '',
          sendStaus: '',
          printStatus: '',
          enterpriseExpressId: ''
        },
        // 查询条件
        searchListQuery: {},
        // 数据字典
        dict: {
          sendStatus: {},
          stopFlag: {},
          thirdPushStatus: {},
          printStatus: {}
        },
        // 平台发货失败表单
        thirdDeliveryForm: {
          todayFail: 0,
          allFail: 0
        },
        // 企业角色flag
        enterpriseRoleFlag: false,
        // 发货单详情visible
        sendDetailVisible: false,
        // 发货单发货visible
        sendDeliveryVisible: false,
        // 仓库发货flag
        warehouseDeliverFlag: false,

        hintVisible: false,
        batchGenerateVisible: false,
        batchManageVisible: false,
        batchImportOrderVisible: false,
        batchPrintVisible: false,
        selectOrderIds: [],
        selectBatchId: '',
        hintForm: {
          failOrderNos: '',
          total: 0,
          successCount: 0,
          failCount: 0
        },

        // 选中行
        selectedSendObj: {},
        // 物流信息
        expressList: [],
        total: 0,
        listLoading: true,
        dataList: [],
        multipleSelection: [],
        sendId: '',
        orderId: '',
        printSendVisible: false,
        // 仓库信息对象
        warehouseInfo: {
          warehouseType: ''
        },
        printList: []
      }
    },
    // 初始化页面
    created() {
      this.enterpriseRoleFlag = this.getSystemRoleType() === '1'
      this.searchListQuery = {
        ...this.defaultQuery
      }
      // 获取数据字典
      getDictByGroupName('ApartOrderDTO.stopFlag').then(response => {
        Object.assign(this.dict, response.data)
      })
      listExpress({ enterpriseId: this.getEnterpriseId(), supplierId: this.getSupplierId(), warehouseId: this.getWarehouseId(), expressStatus: 1 }).then(response => {
        this.expressList = response.data
      })
      if (this.enterpriseRoleFlag) {
        getByEnterpriseId(this.getEnterpriseId()).then(response => {
          const data = response.data
          this.warehouseDeliverFlag = data.warehouseAuthority === 1 && data.warehouseDeliverFlag === 1
        })
      }
      if (this.getSystemRoleType() === '2') {
        getBySupplierId(this.getSupplierId()).then(response => {
          const data = response.data
          this.warehouseDeliverFlag = data.warehouseAuthority === 1 && data.warehouseDeliverFlag === 1
        })
      }
      if (this.getSystemRoleType() === '3') {
        getWarehouse(this.getWarehouseId()).then(response => {
          const data = response.data
          Object.assign(this.warehouseInfo, data)
        })
      }
      this.initList()
    },
    methods: {
      // radio切换事件
      doChangeRadio() {
        this.initList()
      },
      // 初始化
      initList() {
        this.listLoading = true
        this.setSearchListQuery()
        pagingSend(this.searchListQuery).then(response => {
          this.listLoading = false
          if (response.isError) return
          this.dataList = response.data.records
          this.total = response.data.total
          Object.assign(this.dict, response.data.dict)
        })
        if (this.enterpriseRoleFlag) {
          countThirdDeliveryFail(this.getEnterpriseId()).then(response => {
            const data = response.data
            this.thirdDeliveryForm.todayFail = data.todayFail
            this.thirdDeliveryForm.allFail = data.allFail
          })
        }
      },
      // 设置查询条件
      setSearchListQuery() {
        const size = this.searchListQuery.size
        const currentPage = this.searchListQuery.currentPage
        this.searchListQuery = {
          ...this.defaultQuery
        }
        this.searchListQuery.size = size
        this.searchListQuery.currentPage = currentPage
        this.searchListQuery.enterpriseId = this.getEnterpriseId()
        this.searchListQuery.warehouseId = this.getWarehouseId()
        this.searchListQuery.supplierId = this.getSupplierId()
        if (!this.getWarehouseId() && !this.getSupplierId()) {
          // 只查企业总部发货单
          this.searchListQuery.source = 10
        }
        this.searchListQuery[this.textCol] = this.textValue
        this.searchListQuery.dateColumn = this.timeCol
        this.searchListQuery.startDate = (this.timeValue && this.timeValue.length > 0) ? this.timeValue[0] : ''
        this.searchListQuery.endDate = (this.timeValue && this.timeValue.length > 1) ? this.timeValue[1] : ''
        if (this.tabActiveStatus !== 'all') {
          this.searchListQuery.sendStatus = this.tabActiveStatus
        }
        if (this.tabActiveStatus === 'fail') {
          this.searchListQuery.source = ''
          this.searchListQuery.thirdDeliveryStatus = '90'
        }
      },
      // 查询事件
      doSearch() {
        this.searchListQuery.currentPage = 1
        this.initList()
      },
      // 重置事件
      doResetSearch() {
        const originData = this.$options.data()
        this.textCol = originData.textCol
        this.textValue = originData.textValue
        this.timeCol = originData.timeCol
        this.timeValue = originData.timeValue
        this.defaultQuery = originData.defaultQuery
        this.doSearch()
      },
      // 导出事件
      doExport() {
        const url = '/order/projectSend/exportData'
        const fileName = '发货单_' + new Date().toLocaleString() + '.xlsx'
        if (this.multipleSelection.length > 0) {
          const sendIds = this.multipleSelection.map(item => item.sendId)
          downloadFile(url, { sendIds: sendIds.join(',') }, fileName)
        } else {
          this.setSearchListQuery()
          downloadFile(url, this.searchListQuery, fileName)
        }
      },
      // 查看详情事件
      doLinkDetail(row) {
        this.selectedSendObj = row
        this.sendDetailVisible = true
      },
      // 发货单删除事件
      doDelete(row) {
        this.$confirm('确定删除发货单？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.listLoading = true
          doSendDelete(row.sendId).then(response => {
            if (response.isError) {
              this.listLoading = false
              return
            }
            this.$message({ type: 'success', message: '删除成功' })
            this.$emit('resetSendCount')
            this.initList()
          })
        }).catch(() => {
        })
      },
      // 批量删除事件
      doBatchDelete() {
        if (this.multipleSelection.length === 0) {
          this.$message({ message: '请勾选数据', type: 'error' })
          return
        }
        const params = {
          sendIds: this.multipleSelection.map(item => item.sendId)
        }
        this.$bus.$emit('asyncHandle', '300007', params, () => {
          this.$message({ type: 'success', message: '操作成功' })
          this.initList()
        })
      },
      // 推送事件
      doPushThird(row) {
        this.listLoading = true
        doSendPushThird(row.sendId).then(response => {
          if (response.isError) {
            this.listLoading = false
            return
          }
          this.$message({ type: 'success', message: '推送成功' })
          this.initList()
        })
      },
      // 撤销事件
      doCancelThird(row) {
        this.listLoading = true
        doSendCancelThird(row.sendId).then(response => {
          if (response.isError) {
            this.listLoading = false
            return
          }
          this.$message({ type: 'success', message: '撤销成功' })
          this.initList()
        })
      },
      // 确认发货事件
      doConfirmDelivery(row) {
        this.selectedSendObj = row
        this.sendDeliveryVisible = true
      },
      // 发货回调事件
      doCallbackSendDelivery(callbackFlag) {
        if (callbackFlag) {
          this.initList()
        }
        this.sendDeliveryVisible = false
      },
      // 导入发货回调
      doCallbackImportDeliver(callbackFlag) {
        if (callbackFlag) {
          this.initList()
        }
        this.batchImportOrderVisible = false
      },
      // 重试平台发货事件
      doRetry(row) {
        this.listLoading = true
        doRetryThirdDelivery(row.sendId).then(response => {
          if (response.isError) {
            this.listLoading = false
            return
          }
          this.$message({ type: 'success', message: '重试成功' })
          this.initList()
        })
      },
      // 批量重试事件
      doBatchRetry() {
        if (this.multipleSelection.length === 0) {
          this.$message({ message: '请勾选数据', type: 'error' })
          return
        }
        const params = {
          sendIds: this.multipleSelection.map(item => item.sendId)
        }
        this.$bus.$emit('asyncHandle', '300004', params, () => {
          this.$message({ type: 'success', message: '重试成功' })
          this.initList()
        })
      },
      // ============================= 打印面单相关 =======================
      // 批量打印
      doBatchPrint() {
        if (this.multipleSelection.length <= 0) {
          this.$message({ type: 'error', message: '请选择要打印的订单！' })
          return
        }
        const list = this.multipleSelection
        let platformType = 0
        const printList = []
        list.forEach((item, index) => {
          const sendInfo = {}
          let platformTypeOther = 0
          if (item.orderType === 33 || item.orderType === 34) {
            const externalPlatformType = item.externalPlatformType
            // 导入的订单按快递鸟
            if (externalPlatformType !== 99) {
              platformTypeOther = externalPlatformType === 5 ? 3 : externalPlatformType
            }
          }
          if (index === 0) {
            platformType = platformTypeOther
          } else {
            if (platformType !== platformTypeOther) {
              this.$message({ type: 'error', message: '请选择同一平台的订单进行打印！' })
              return
            }
          }
          if (item.sendStatus === 30) {
            this.$message({ type: 'error', message: '不能打印已发货的订单，请重新选择！' })
            return
          }
          if (item.stopFlag !== 0) {
            this.$message({ type: 'error', message: '不能打印已截停的订单，请重新选择！' })
            return
          }
          sendInfo.orderId = item.orderId
          sendInfo.sendId = item.sendId
          printList.push(sendInfo)
        })
        this.printList = printList
        this.printSendVisible = true
      },
      // 打印面单
      doPrint(row) {
        this.printList = []
        const sendInfo = {
          orderId: row.orderId,
          sendId: row.sendId
        }
        this.printList.push(sendInfo)
        this.printSendVisible = true
      },
      // 打开批次生成dialog
      openBatchGenerate() {
        const list = this.multipleSelection.length > 0 ? this.multipleSelection : this.dataList
        this.selectOrderIds = []
        if (list.length > 0) {
          var orderIds = []
          list.forEach(obj => {
            orderIds.push(obj.orderId)
          })
          const form = {
            enterpriseId: this.getEnterpriseId(),
            orderIds: orderIds
          }
          listOrderFromBaseByOrderIds(form).then(response => {
            if (response.isError) return
            var data = response.data
            var failOrderNos = ''
            list.forEach(obj => {
              if (data.failIds.indexOf(obj.orderId) !== -1) failOrderNos += obj.orderNo + ','
            })
            this.hintForm = {
              failOrderNos: failOrderNos.substring(0, failOrderNos.length - 1),
              total: data.total,
              successCount: data.successCount,
              failCount: data.failCount
            }
            this.selectOrderIds = data.successIds ? data.successIds : []
            this.hintVisible = true
          })
        } else {
          this.$message({
            message: '请选择订单',
            type: 'warning'
          })
        }
      },
      // 关闭dialog
      closeBatchGenerate(refreshFlag) {
        this.selectOrderIds = []
        this.batchGenerateVisible = false
        if (refreshFlag) this.initList()
      },
      // 打开批次管理dialog
      openBatchManage() {
        this.batchManageVisible = true
      },
      // 复制事件
      handleClipboard(text, event) {
        clipboard(text, event)
      },
      // 提示确定事件
      doHintConfirm() {
        this.hintVisible = false
        if (this.hintForm.successCount > 0) this.batchGenerateVisible = true
      },
      // 跳转批量打印管理dialog
      linkPrint(batchId) {
        this.batchManageVisible = false
        this.batchPrintVisible = true
        this.selectBatchId = batchId
      },
      // ============================= 打印面单相关 =======================
      // 勾选事件
      handleSelectionChange(val) {
        this.multipleSelection = val
      },
      // 更改当前页数
      handleCurrentChange(val) {
        this.searchListQuery.currentPage = val
        this.initList()
      },
      // 更改当前页面大小
      handleSizeChange(val) {
        this.searchListQuery.size = val
        this.initList()
      }
    }
  }
</script>

<style lang="less" scoped>

</style>
